package brwarner.game.ui 
{
	import brwarner.game.Humans;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.text.TextField;
	
	/**
	 * ...
	 * @author Brook Jensen
	 */
	public class HumanPanel extends Sprite 
	{
		//Text field to show funds
		var _fundsField:TextField;
		
		//Human class
		var _humans:Humans;		
		
		public function HumanPanel( h:Humans ) 
		{
			_humans = h;
			_fundsField = new TextField();
			addChild(_fundsField);
			
			_humans.addEventListener(Humans.THINK_EVENT, onHumanThink);
			
			redraw();
		}
		
		private function redraw( ):void
		{
			graphics.clear();
			graphics.lineStyle( 1, 0 );
			graphics.beginFill( 0xFFFFFF );
			graphics.drawRect( 0, 0, 150, 150 );
			graphics.endFill();
		}
		
		private function onHumanThink( e:Event ):void
		{
			//Update funds field
			_fundsField.text = "Funds: " + _humans.Funds + "\nPopulation: " + _humans.Population;
		}
		
	}

}